package com.zenithmind.exam.pojo.vo;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;

/**
 * 考试记录VO
 * 
 * @author ZenithMind
 * @since 2024-07-01
 */
@Data
@Schema(name = "考试记录VO", description = "考试记录视图对象")
public class ExamRecordVO {

    /**
     * 记录ID
     */
    @Schema(description = "记录ID")
    private String id;

    /**
     * 考试ID
     */
    @Schema(description = "考试ID")
    private String examId;

    /**
     * 考试标题
     */
    @Schema(description = "考试标题")
    private String examTitle;

    /**
     * 用户ID
     */
    @Schema(description = "用户ID")
    private String userId;

    /**
     * 用户姓名
     */
    @Schema(description = "用户姓名")
    private String userName;

    /**
     * 状态（0:未开始, 1:进行中, 2:已提交, 3:已评分, 4:已超时）
     */
    @Schema(description = "状态（0:未开始, 1:进行中, 2:已提交, 3:已评分, 4:已超时）")
    private Integer status;

    /**
     * 状态名称
     */
    @Schema(description = "状态名称")
    private String statusName;

    /**
     * 开始时间
     */
    @Schema(description = "开始时间")
    private LocalDateTime startTime;

    /**
     * 提交时间
     */
    @Schema(description = "提交时间")
    private LocalDateTime submitTime;

    /**
     * 用时（秒）
     */
    @Schema(description = "用时（秒）")
    private Integer durationSeconds;

    /**
     * 用时格式化
     */
    @Schema(description = "用时格式化")
    private String durationFormatted;

    /**
     * 总分
     */
    @Schema(description = "总分")
    private Integer totalScore;

    /**
     * 用户得分
     */
    @Schema(description = "用户得分")
    private BigDecimal userScore;

    /**
     * 得分率
     */
    @Schema(description = "得分率")
    private BigDecimal scoreRate;

    /**
     * 正确题目数
     */
    @Schema(description = "正确题目数")
    private Integer correctCount;

    /**
     * 错误题目数
     */
    @Schema(description = "错误题目数")
    private Integer wrongCount;

    /**
     * 未答题目数
     */
    @Schema(description = "未答题目数")
    private Integer unansweredCount;

    /**
     * 是否及格
     */
    @Schema(description = "是否及格")
    private Boolean isPassed;

    /**
     * 排名
     */
    @Schema(description = "排名")
    private Integer ranking;

    /**
     * 答题详情
     */
    @Schema(description = "答题详情")
    private List<AnswerDetailVO> answerDetails;

    /**
     * 创建时间
     */
    @Schema(description = "创建时间")
    private LocalDateTime createTime;

    /**
     * 答题详情VO
     */
    @Data
    @Schema(name = "答题详情VO", description = "答题详情视图对象")
    public static class AnswerDetailVO {
        
        /**
         * 题目ID
         */
        @Schema(description = "题目ID")
        private String questionId;

        /**
         * 题目标题
         */
        @Schema(description = "题目标题")
        private String questionTitle;

        /**
         * 题目类型
         */
        @Schema(description = "题目类型")
        private Integer questionType;

        /**
         * 题目分值
         */
        @Schema(description = "题目分值")
        private Integer questionScore;

        /**
         * 用户答案
         */
        @Schema(description = "用户答案")
        private List<String> userAnswer;

        /**
         * 正确答案
         */
        @Schema(description = "正确答案")
        private List<String> correctAnswer;

        /**
         * 用户得分
         */
        @Schema(description = "用户得分")
        private BigDecimal userScore;

        /**
         * 是否正确
         */
        @Schema(description = "是否正确")
        private Integer isCorrect;

        /**
         * 答题时间
         */
        @Schema(description = "答题时间")
        private LocalDateTime answerTime;

        /**
         * 答题用时（秒）
         */
        @Schema(description = "答题用时（秒）")
        private Integer timeSpent;
    }
}
